<?php
require_once("./DButil.php");

header("Content-Type:application/json;charset=utf-8");
$arr=$_SESSION["loginTeacher"];

// print_r($_SESSION["loginTeacher"]);

//     [teacherId] => 4001
//     [teacherName] => 张三
//     [username] => zhangsan
//     [status] => 1
//     [roleId] => 1001
// var_dump($arr["roleId"]);

if ($arr) {
    $sql="select p.powerName name,p.powerPath path from t_role_power rp 
    left join t_power p on rp.powerId=p.powerId
    where rp.roleId={$arr['roleId']}" ;
    
    if (query($sql)) {
        $result=query($sql);
        $result[]=["username" => $arr["username"]];
    }
    
    
    echo json_encode($result);
}else{
    $result =0;
    echo json_encode($result);
}

?>